package com.akk.module.avs.service;

import com.akk.module.avs.entity.AvsHotBank;
import com.akk.module.avs.entity.AvsHotBankExample;
import com.akk.module.avs.mapper.AvsHotBankMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AvsHotBankService {

    @Autowired
    private AvsHotBankMapper hotBankMapper;

    @Autowired
    private AvsHotBankExample hotBankExample;

    public List<AvsHotBank> queryList(){
        hotBankExample.clear();
        hotBankExample.createCriteria();
        return hotBankMapper.selectByExample(hotBankExample);
    }

    public List<AvsHotBank> queryByParams(Map params){
        hotBankExample.clear();
        AvsHotBankExample.Criteria criteria = hotBankExample.createCriteria();
        if (params.containsKey("hot"))
            criteria.andBankHotEqualTo(Integer.valueOf(params.get("hot").toString()));
        return hotBankMapper.selectByExample(hotBankExample);
    }

    public void save(AvsHotBank hotBank){
        hotBankMapper.insert(hotBank);
    }

    public void update(AvsHotBank hotBank){
        hotBankMapper.updateByPrimaryKey(hotBank);
    }

    public AvsHotBank queryById(Long bankId){
        return hotBankMapper.selectByPrimaryKey(bankId);
    }

    public void delete(Long bankId){
        hotBankMapper.deleteByPrimaryKey(bankId);
    }

}
